# import the necessary packages
import argparse
import cv2 as cv

# consturct the argument parser and pares the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="The Path To Image")
args = vars(ap.parse_args())

# load the original image and display idt (RGB)
image = cv.imread(args["image"])
cv.imshow("RGB", image)

# loop over each of the individual channels and display them
for (name, chan) in zip(("B", "G", "R"), cv.split(image)):
    cv.imshow(name, chan)

# wait for a keypress,then close all open windows
cv.waitKey(0)
cv.destroyAllWindows()

# convert the image to the HSV color space and show it
hsv = cv.cvtColor(image, cv.COLOR_BGR2HSV)
cv.imshow("HSV", hsv)

# loop over each of the individual channels and display them
for (name, chan) in zip(("H", "S", "V"), cv.split(hsv)):
    cv.imshow(name, chan)

# wait for a keypress ,then close all open windows
cv.waitKey(0)
cv.destroyAllWindows()

# convert the image to the  L * a * b color space and show it
lab = cv.cvtColor(image, cv.COLOR_BGR2LAB)
cv.imshow("L*a*b", lab)

# loop over each of the individual channels and display them
for (name, chan) in zip(("L*", "a*", "b*"), cv.split(lab)):
    cv.imshow(name, chan)

# wait ofr a keypress,then close all open windows
cv.waitKey(0)
cv.destroyAllWindows()

# show the original and grayscalse versions of the image
gray = cv.cvtColor(image,cv.COLOR_BGR2GRAY)
cv.imshow("Original",image)
cv.imshow("Grayscale",gray)
cv.waitKey(0)